/*============================================================================*/
/*  Copyright (C) 2009-2011, iSOFT INFRASTRUCTURE SOFTWARE CO.,LTD.
 *  
 *  All rights reserved. This software is iSOFT property. Duplication 
 *  or disclosure without iSOFT written authorization is prohibited.
 *  
 *  
 *  @file       <Xcp_GenericTypes.h>
 *  @brief      <gerneric Typedef head file of XCP module>
 *  
 *  <Compiler: Codewarrior for mpc55xx v2.6     MCU:MPC56XX>
 *  
 *  @author     <Dongyuan.Sun, qitao.Yu>
 *  @date       <2013-03-06>
 */
/*============================================================================*/
#ifndef  XCP_GENERICTYPES_H
#define  XCP_GENERICTYPES_H

/*=======[R E V I S I O N   H I S T O R Y]====================================*/
/*  <VERSION>    <DATE>    <AUTHOR>     <REVISION LOG>
 *  V1.0.0       20081127  Dongyuan.Sun Initial version
 * 
 */
/*============================================================================*/

/*=======[I N C L U D E S]====================================================*/
#include"ComStack_Types.h"

/*=======[V E R S I O N  I N F O R M A T I O N]===============================*/
#define XCP_GENERICTYPES_H_VENDOR_ID  0
#define XCP_GENERICTYPES_H_MODULE_ID  0
#define XCP_GENERICTYPES_H_AR_MAJOR_VERSION  4
#define XCP_GENERICTYPES_H_AR_MINOR_VERSION  0
#define XCP_GENERICTYPES_H_AR_PATCH_VERSION  3
#define XCP_GENERICTYPES_H_SW_MAJOR_VERSION  1
#define XCP_GENERICTYPES_H_SW_MINOR_VERSION  0
#define XCP_GENERICTYPES_H_SW_PATCH_VERSION  0
#define XCP_GENERICTYPES_H_VENDOR_API_INFIX  0

/*=======[M A C R O S]========================================================*/
#define XCP_CONST
#define XCP_CONST_PBCFG
#define XCP_VAR

#define XCP_APPL_DATA
#define XCP_APPL_CONST

#define XCP_CODE

/* Bitmask for Priviledge Level */
#define XCP_PL_CAL      0x01u
#define XCP_PL_DAQ      0x04u
#define XCP_PL_STIM     0x08u
#define XCP_PL_PGM      0x10u

#define XCP_DAQ_STATIC  0u
#define XCP_DAQ_DYNAMIC 1u

#define XCP_PID_ABSOLUTE                0u
#define XCP_PID_RELATIVE_BYTE           1u
#define XCP_PID_RELATIVE_WORD           2u
#define XCP_PID_RELATIVE_WORD_ALIGNED   3u

#define XCP_TS_NO_TS        0u
#define XCP_TS_ONE_BYTE     1u
#define XCP_TS_TWO_BYTE     2u
#define XCP_TS_FOUR_BYTE    4u

#define XCP_AG_BYTE         0u
#define XCP_AG_WORD         1u
#define XCP_AG_DWORD        2u

#define XCP_DAQ_OVERLOAD_NO_INDIC   0u
#define XCP_DAQ_OVERLOAD_PID        1u
#define XCP_DAQ_OVERLOAD_EV         2u

#define XCP_TIME_UNIT_1NS      0
#define XCP_TIME_UNIT_10NS     1
#define XCP_TIME_UNIT_100NS    2
#define XCP_TIME_UNIT_1US      3
#define XCP_TIME_UNIT_10US     4
#define XCP_TIME_UNIT_100US    5
#define XCP_TIME_UNIT_1MS      6
#define XCP_TIME_UNIT_10MS     7
#define XCP_TIME_UNIT_100MS    8
#define XCP_TIME_UNIT_1S       9
#define XCP_TIME_UNIT_1PS      10
#define XCP_TIME_UNIT_10PS     11
#define XCP_TIME_UNIT_100PS    12

/*=======[T Y P E   D E F I N I T I O N S]====================================*/
typedef enum
{
    TIMESTAMP_UNIT_1NS = 0,
    TIMESTAMP_UNIT_10NS,
    TIMESTAMP_UNIT_100NS,
    TIMESTAMP_UNIT_1US,
    TIMESTAMP_UNIT_10US,
    TIMESTAMP_UNIT_100US,
    TIMESTAMP_UNIT_1MS,
    TIMESTAMP_UNIT_10MS,
    TIMESTAMP_UNIT_100MS,
    TIMESTAMP_UNIT_1S,
    TIMESTAMP_UNIT_1PS,
    TIMESTAMP_UNIT_10PS,
    TIMESTAMP_UNIT_100PS
}Xcp_TimeUintType;

typedef enum
{
    DAQ = 1,
    STIM = 2,
    DAQ_STIM = 3
}Xcp_DaqDirectionType;

typedef enum
{
    XCP_DAQ_CFG_IDLE = 0,
    XCP_DAQ_CFG_FREE,
    XCP_DAQ_CFG_DAQ,
    XCP_DAQ_CFG_ODT,
    XCP_DAQ_CFG_ENTRY,
    XCP_DAQ_CFG_DONE
}Xcp_DaqCfgStatusType;

typedef enum
{
    XCP_EVENT_CONSIST_ODT = 0,
    XCP_EVENT_CONSIST_DAQ = 1,
    XCP_EVENT_CONSIST_EVENT = 2
}Xcp_EventChannelConsistType;

typedef enum
{
    XCP_UINIT,
    XCP_DISCONNECT,
    XCP_PRE_CONNECT,
    XCP_CONNECT,
    XCP_PRE_USERDEFINE,
    XCP_USERDEFINE,
    XCP_SLEEP
}Xcp_StatusType;

typedef enum
{
    XCP_CMD_IDLE,
    XCP_CMD_BLOCK_RECV,
    XCP_CMD_RECV,
    XCP_CMD_EXCUTE,
    XCP_CMD_BLOCK_TRANSF,
    XCP_CMD_TRANSF
}Xcp_CommandStatusType;

typedef enum
{
    XCP_PRE_SEED,
    XCP_SEED,
    XCP_PRE_KEY,
    XCP_KEY
}Xcp_SeedandKeyStatusType;

typedef struct
{
    uint8   extension;
    uint32  transferAddr;
}Xcp_AddressType;

typedef struct
{
	uint32 	epn;
	uint32 	rpn;
	uint8   size; 
	uint8   vaild;
	uint8 	tid;
	uint8   mas2flag;
}Xcp_TLBInfoType;

#endif  /* endof XCP_H */

/*=======[E N D   O F   F I L E]==============================================*/

